from django.conf.urls import url

from . import views

urlpatterns = [
    # 用户注册
    url('^register/$', views.RegisterView.as_view(), name="register"),
    # 判断用户名是否重复
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view()),
    # 用户登录
    url('^login/$', views.LoginView.as_view(), name="login"),
    # 用户退出
    url('^logout/$', views.LogoutView.as_view(), name="logout"),
    # 用户退出
    url('^info/$', views.UserInfoView.as_view(), name="info"),
    # 添加邮箱
    url('^emails/$', views.EmailView.as_view()),
    # 验证邮箱
    url('^emails/verification/$', views.VerifyEmailView.as_view()),
    # 用户地址
    url('^addresses/$', views.AddressView.as_view(), name='address'),
    # 用户新增
    url('^addresses/create/$', views.AddressCreateView.as_view()),
    # 用户修改和删除
    url('^addresses/(?P<address_id>\d+)/$', views.UpdateDestoryAddressView.as_view()),
    # 设置默认地址
    url('^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view()),
    # 用户浏览记录
    url('^browse_histories/$', views.UserBrowseHistoryView.as_view()),
]
